package com.hopes.bizz.risk.transfer.converter;

import com.hopes.bizz.risk.control.entity.RiskUnitEventEntity;
import com.hopes.bizz.risk.transfer.bean.dto.RiskEventDto;
import org.mapstruct.BeanMapping;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * @author lyb
 * @version 1.0
 * @description: 风险事件转换
 * @date 2024/2/2 17:12
 */
@Mapper
public interface RiskEventConverter {

    RiskEventConverter INSTANCE = Mappers.getMapper(RiskEventConverter.class);

    @Mapping(target = "uid", source = "id")
    @Mapping(target = "delFlag", source = "deleted", defaultValue = "0")
    @Mapping(target = "createTime", source = "createDate", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @Mapping(target = "createBy", source = "createBy")
    @Mapping(target = "updateTime", source = "updateDate", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @Mapping(target = "updateBy", source = "updateBy")
    @Mapping(target = "eventName", source = "riskEventName")
    @BeanMapping(ignoreByDefault = true)
    RiskUnitEventEntity toEntity(RiskEventDto riskEventDto);
}
